* Replication commands for Rikhil R. Bhavnani and Bethany Lacina, 2018, Nativism and Economic Integration across the Developing World, Cambridge University Press. Figure 9, Tables 9 & S7.

global controlsexceptunemploy 	ADEprecip_avg Lpdegrade_avg Lincome_avg Lpcprod Lpop_avgnat Lurbannat Lschoolmnat Lybulgenat 

*Figure 9
capture drop migresid instrresid
xi: reg Losm_all_avg $controlsexceptunemploy i.stname [aweight=yrswght]
predict migresid, resid
xi: reg LPDW_ADEprecip $controlsexceptunemploy i.stname [aweight=yrswght]
predict instrresid, resid
reg migresid instrresid [aweight=yrswght]

twoway (scatter migresid instrresid) || (lfit migresid instrresid, lpattern(solid)), ytitle("{it:Ln} internal migrants | X") xtitle("Abnormal monsoon instrument | X") legend(off)
graph2tex, eps(instr1)

*Table 9
*Model 1
reg Lriots_cii_avg Losm_all_avg [aweight=yrswght] , cl(stname)

*Model 2
xi: reg Lriots_cii_avg Losm_all_avg $controlsexceptunemploy i.stname    [aweight=yrswght] , cl(stname)

*Model 3, stage 1 and 2
xi: ivreg2 Lriots_cii_avg (Losm_all_avg=LPDW_ADEprecip) $controlsexceptunemploy i.stname [aweight=yrswght] , first robust bw(2) 

*Model 4
xi: reg Lriots_cii_avg Losm_all_avgnotreatment Losm_all_avgtreatment treatment $controlsexceptunemploy  i.stname    [aweight=yrswght], cl(stname)


*Table S7
*2SLS with weak instrumentation

xi: ivreg2 Lriots_cii_avg (Losm_all_avgnotreatment Losm_all_avgtreatment =LPDW_ADEprecipnotreatment LPDW_ADEpreciptreatment) treatment $controlsexceptunemploy i.stname [aweight=yrswght] , first robust bw(2)
test Losm_all_avgnotreatment=Losm_all_avgtreatment
